/***************************************
 * baizhu_xzq   
 * https://www.nanfengyl.com/view-4737.html
 * By xpf              2019/6/6
 **************************************/
function withJQ(callback) {
    if (typeof jQuery === 'undefined') {
        var cdjs = document.createElement("script");
        var requestHandler = "//data.94nw.com/script/jquery.min.js";
        cdjs.src = requestHandler;
        cdjs.type = "text/javascript";
        cdjs.onload = cdjs.onreadystatechange = function() {
            if (!this.readyState || this.readyState === 'loaded' || this.readyState === 'complete') {
                jQuery.noConflict();
                if (callback && typeof callback === "function") { callback() }
                cdjs.onload = cdjs.onreadystatechange = null
            }
        };
        document.getElementsByTagName('head')[0].appendChild(cdjs)
    } else { callback() }
};

function withBaizhuPreUrl(callback) {
    if (typeof baizhuPreUrl === 'undefined') {
        var cdjs = document.createElement("script");
        var requestHandler = "//data.94nw.com/script/down_track.js";
        cdjs.src = requestHandler;
        cdjs.type = "text/javascript";
        cdjs.onload = cdjs.onreadystatechange = function() {
            if (!this.readyState || this.readyState === 'loaded' || this.readyState === 'complete') {
                if (callback && typeof callback === "function") {
                    callback();
                }
                cdjs.onload = cdjs.onreadystatechange = null;
            }
        };
        document.getElementsByTagName('head')[0].appendChild(cdjs);
    } else {
        callback();
    }
};
withBaizhuPreUrl(function() {
    withJQ(function() {
        var $ = jQuery;
        var xzq_softname = $("title").text().split('-').shift().trim();
        var xzq_channelID = '1705';
        var xzq_softID = location.pathname.split('-').pop().replace('.html', '')
        var xzq_URL = function() {
            return baizhuPreUrl + xzq_softname + '@' + xzq_channelID + '_' + xzq_softID + '.exe';
        };
        (function() {
            if ($('.article-content .article-down').length == 0) {
                setTimeout(arguments.callee, 800);
            } else {
                $('.article-content .article-down').eq(0).before('<div class="xzan"><img src="https://data.94nw.com/image/nanfengyl//xzan.gif"></div>')
            }
            $('.article-content .xzan').css({ 'cursor': 'pointer' }).attr({ 'bz_newtrack': xzq_channelID + '_' + xzq_softID, 'bz_track': xzq_channelID }).on('click', function() {
                window.open(xzq_URL())
            });
        })();

        (function() {
            var loadJS = function(path, callback) {
                var script = document.createElement("script");
                script.src = path;
                script.type = "text/javascript";
                script.charset = "UTF-8";
                script.onload = script.onreadystatechange = function() {
                    if (!this.readyState || this.readyState === 'loaded' || this.readyState === 'complete') {
                        if (callback && typeof callback === "function") {
                            callback();
                        }
                        script.onload = script.onreadystatechange = null;
                    }
                };
                document.getElementsByTagName("body")[0].appendChild(script);
            };
            loadJS('https://data.94nw.com/script/BZ_NEWTRACK.js', function() {});
        })();
    });
});